package com.simple.jdbc.core.pojo;

import javax.sql.DataSource;
import java.util.HashMap;
import java.util.Map;

/**
 * 全局配置类 存SimpleJDBCConfig.xml 相关信息
 */
public class Configuration {

    //数据源对象
    private DataSource dataSource;
    //MappedStatement 的 map集合 key statementId value 封装好的mappedStatement对象
    private Map<String,MappedStatement> mappedStatementMap = new HashMap<>();

    public DataSource getDataSource() {
        return dataSource;
    }

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public void addMappedStatement(MappedStatement mappedStatement){
        mappedStatementMap.put(mappedStatement.getStatementId(),mappedStatement);
    }

    public MappedStatement getMappedStatementByStatementId(String statementId){
        return mappedStatementMap.get(statementId);
    }

}
